from odoo import api, fields, models, _
import logging
from odoo.exceptions import UserError

logger = logging.getLogger(__name__)


class duty_useless(models.Model):
    _name = 'duty.useless'
    _description = 'user_info'

    duty_id = fields.Char(
        string='追责单编号',
        index=True,
        readonly=True,
    )

    # 疫苗ID
    vaccine_id = fields.Char('疫苗ID', required=True)

    # 疫苗名称

    name = fields.Char(
        string='疫苗中文名',
        required=True
    )
    # 疫苗类别
    vaccine_category = fields.Selection(
        [
            ('1', 'HPV疫苗'),
            ('2', '卡介苗'),
            ('3', '小儿麻痹疫苗'),
            ('4', '狂犬疫苗'),
            ('5', '乙肝疫苗'),
            ('6', '水痘疫苗'),
            ('7', '其他'),
        ],
        string='疫苗类别',
        required=True
    )

    # 单位名称
    organization_name = fields.Char('单位名称', required=True)

    # 生产企业
    manufacturer = fields.Many2one('factory', string='生产企业', required=True)

    # 生产批号
    batch_number = fields.Char('生产批号', required=True)

    # 规格
    standard = fields.Selection(
        [
            ('1', '0.5ml/支'),
            ('2', '1.0ml/支'),
            ('3', '1.5ml/支'),
            ('4', '2.0ml/支'),
            ('5', '2.5ml/支'),
            ('6', '其他'),
        ],
        string='规格',
        required=True
    )
    duty_reason = fields.Html(
        '追责原因',
        required=True
    )
    reason = fields.Html(
        '无效原因',
        required=True
    )

